Jump to content

Talk:2016 NCAA Division I Indoor Track and Field Championships

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Script used to generate results tables

[edit]

Here's the script I used to generate the results tables from TFRRS:

nath={
  'Olivia Baker': 'Olivia Baker (runner)|',
  'Heather MacLean': 'Heather MacLean (runner)|',
  'Grace Barnett': 'Grace Barnett (runner)|',
  'Erin Clark': 'Erin Clark (runner)|',
  'Courtney Smith': 'Courtney Smith (runner)|',
  'Sarah Collins': 'Sarah Collins (runner)|',
  'Taylor Bennett': 'Taylor Bennett (runner)|',
  'Alexis Hernandez': 'Alexis Hernandez (runner)|',
  'Heather Martin': 'Heather Martin (runner)|',
  'Jessica Harris': 'Jessica Harris (runner)|',
  'Olivia Anderson': 'Olivia Anderson (runner)|',
  'Megan Clark': 'Megan Clark (pole vaulter)|',
  'Emily Grove': 'Emily Grove (athlete)|',
  'Kate Hall': 'Kate Hall (athlete)|',
  'Simone Charley': 'Simone Charley (triple jumper)|',
  'Ashley Jenkins': 'Ashley Jenkins (athlete)|',
  'Leigha Brown': 'Leigha Brown (athlete)|',
};
[...document.querySelectorAll('.custom-table-title')].filter(t=>!t.innerText.match(/Prelim|Section/)).map(t=>{
  const title = t.querySelector('h3').innerText;
  const trs = [...t.parentElement.querySelectorAll('tbody tr')];
  return `===${title.replace(' Finals', '')}===

{| class="wikitable sortable" style="text-align: center;"
! Rank !! Athlete !! Team !! Mark
${trs.flatMap(tr => {
  const tds = [...tr.querySelectorAll('td')].map(td => td.innerText);
  if (!tds[2]) return [];
  const relay = title.includes('Relay');
  const team = relay ? tds[1] : tds[3];
  const mark = relay ? tds[3] : tds[4];
  return `|-
| ${{1: '{{Gold1}}', 2: '{{Silver2}}', 3: '{{Bronze3}}'}[tds[0]] ?? tds[0]} ||align=left| ${(relay ? tds[2].split(', ') : [tds[1]]).map(ath => `[[${nath[ath] ?? ath}]]`).join(', ')} || '''${team}''' || '''${mark}'''`
}).join('\n')}
|}`;
}).join('\n\n')

--Habst (talk) 00:29, 10 November 2023 (UTC)[reply]